package com.chinairi.mall.controller;


import com.chinairi.common.utils.ResponseUtil;
import com.chinairi.mall.controller.viewobject.ProjectPlanReqVO;
import com.chinairi.mall.model.ProjectPlanReqStorage;
import com.chinairi.mall.model.StorageAddress;
import com.chinairi.mall.service.IProjectPlanReqStorageService;
import com.chinairi.mall.service.modelobject.ProjectPlanReqStorageMO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.chinairi.common.controller.BaseController;

import java.io.IOException;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Webgasd
 * @since 2020-10-15
 */
@RestController
@RequestMapping("/project-plan-req-storage")
public class ProjectPlanReqStorageController extends BaseController {

    @Autowired
    private IProjectPlanReqStorageService iProjectPlanReqStorageService;

    @PostMapping("/selectStorageList")
    public void selectStorageList(@RequestBody ProjectPlanReqVO projectPlanReqVO) throws IOException {
        List<StorageAddress> storageAddressList = iProjectPlanReqStorageService.selectStorageList(projectPlanReqVO);
        ResponseUtil.showMessage("success", "获取需求计划成功", storageAddressList);
    }

    /**
     * 获取平库列表
     * @param projectPlanReqStorage
     * @throws IOException
     */
    @GetMapping("/selectStorageList")
    public void selectStorageList(ProjectPlanReqStorage projectPlanReqStorage) throws IOException {
        List<ProjectPlanReqStorageMO> projectPlanReqStorageMOList = iProjectPlanReqStorageService.getStorageFlatList(projectPlanReqStorage);
        ResponseUtil.showMessage("success", "获取需求计划成功", projectPlanReqStorageMOList);
    }
}
